def is_prime(n):
    if n < 2:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True

primes = [n for n in range(1, 20001) if is_prime(n)]

# 按每行 5 个打印素数
for i in range(0, len(primes), 5):
    print(' '.join(map(str, primes[i:i+5])))

